The Collatz Conjecture
During the 1930's, Lothar
Collatz at the
.
Design your code so that n is an unsigned long int and so that you can
input the initial value of n from the console. Use an if/else if/else
structure to control the flow of the algorithm. Use a "while(true)"
loop with "cin.get()" so that the numbers are displayed in the
console window at a rate of one output number per keypress.
Submit your code as XX_Collatz01.cpp where “XX” are your initials.
Studies such as Collatz' may be said to have led to B. Thwaite's discovery, in 1952, of the "3x+1 problem", which is concerned with iterates of the function
5.
Write a C++ program with will take a natural number
input, n, and output to the console the sequence of iterates .
Save this program as XX_Collatz05.cpp.
6. Experiment with various different initial values. Describe the results of your experimentation.